﻿using System;
using System.Collections.Concurrent;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using MappingGenerator;
using MappingGenerator.Formatting;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTesing
{
    [TestClass]
    public class NamingConvensionTest
    {
        [TestMethod]
        public void CapsUnderscoreTableNames()
        {
            var converter = new AllCapsUnderscoreStringFormatter();
            converter.PreFixes .AddRange(new string[]{"tbl", "TBL"});

            Assert.AreEqual("Deposit",converter.Convert("TBL_DEPOSIT"));
            Assert.AreEqual("DepositDetail", converter.Convert("TBL_DEPOSIT_DETAIL"));
            Assert.AreEqual("DepositDetail", converter.Convert("DEPOSIT_DETAIL"));

        }
        [TestMethod]
        public void CapsUnderscoreColumnNames()
        {
            var converter = new AllCapsUnderscoreStringFormatter();
            converter.PreFixes.AddRange(new string[] { "PK_", "pk_", "FK_", "fk_", "PK", "pk", "FK", "fk" });

            Assert.AreEqual("DepositBranch", converter.Convert("DEPOSIT_BRANCH"));
            Assert.AreEqual("DepositId", converter.Convert("PK_DEPOSIT_ID"));
            Assert.AreEqual("DepositId", converter.Convert("FK_DEPOSIT_ID"));

        }
    }
}
